﻿using System;

namespace Server.Model
{
    public class PingData
    {
        private long _numberOfTries;

        private bool _receivedPing;

        #region LOCKS

        private readonly Object _receivedPingLock = new Object();
        private readonly Object _tryNumber = new Object();

        #endregion LOCKS

        public long NumberOfTries
        {
            get
            {
                long tmp;
                lock (_tryNumber) tmp = _numberOfTries;
                return tmp;
            }
            set
            {
                lock (_tryNumber) _numberOfTries = value;
            }
        }

        public bool PingReceived
        {
            get
            {
                bool tmp;
                lock (_receivedPingLock) tmp = _receivedPing;
                return tmp;
            }
            set
            {
                lock (_receivedPingLock) _receivedPing = value;
            }
        }

        public PingData()
        {
            _numberOfTries = 0;
            _receivedPing = true;
        }
    }
}